home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1996 #14
/
Monster Media No. 14 (April 1996) (Monster Media, Inc.).ISO
/
pcboard
/
msgtag11.zip
/
KILL.PPS
< prev
next >
Wrap
Text File
|
1996-01-30
|
6KB
|
201 lines
; KILL.PPE by Dan Shore - SysOp
; The Shoreline BBS
;
; Purpose: This PPE will allow the KILL command to accept more than
; one message number at a time.
;
; KILL.PPE will accept multiple numbers or ranges of numbers
; either when stacking at the main command line or when
; prompted for "Enter message number to kill".
;
; For example: "1 2 3" or "1-3" are acceptable entries.
;
;──────────────────────────────────────────────────────────────────────────────
;
; Revised on : 11/02/95
; Revised by : Dan Shore
; Purpose : Modification due to PCB TOKCOUNT and GETTOKEN()
; limitations of only reading upto the 256th
; character of a BIGSTR
;
;──────────────────────────────────────────────────────────────────────────────
;
; To install:
;
; 1) Edit your CMD.LST file(s) to add this:
;
; Charges Per PPE/MNU File Specification -or-
; Command Sec Minute Use Keystroke Substitution
; ══════════════ ═══ ═════════════════ ═════════════════════════════════
; 1) K 5 0 0 C:\PCB\PPE\KILL\KILL.PPE
;
; Note: You may have to change the pathname to the PPE.
;
;
;───────────────────────────────────────────────────────────────────────────
STRING main_prompt ' Generic input prompt
STRING stack_var ' used for parsing stacked input
STRING temp_var ' used when parsing range input
STRING hold ' Generic string variable
STRING temp ' Generic string variable
STRING tag_msg_file ' Path/filename of tagged msgs
BIGSTR user_input ' Generic user input - used also to hold tag list
INTEGER hold_num ' Generic integer used for range input
INTEGER count ' counts command line parms
INTEGER start ' starting number of range
INTEGER end ' ending number of range
BOOLEAN tagged_files ' TRUE if there are files tagged
;───────────────────────────────────────────────────────────────────────────
:MAIN
'
' Get path to swap file directory
'
hold = READLINE(PCBDAT(),204)
hold = FILEINF(hold,6) + ":" + FILEINF(hold,7)
'
' Determine paths and names of files used by KILL.PPE
'
tag_msg_file = hold + "mtg" + STRING(CURCONF()) + ".lst"
'
' Count command line paramaters (stacked)
'
count = TOKCOUNT()
'
' If there are no stacked commands display KILL Msg prompt and
' get their response
'
IF (count < 1) THEN
IF (EXIST(tag_msg_file)) THEN
IF (FILEINF(tag_msg_file,4) > 0) tagged_files = TRUE
END IF
PRINTLN "@X0F*@X0D────────────────────────────────────────@X0F*"
PRINTLN " @X0BEnter single numbers @X0F(@X0E1 4 9@X0F)@X0B or enter"
PRINTLN " @X0Branges @X0F(@X0E1-4 6-12@X0F)@X0B of msg #'s to kill@X07"
NEWLINE
PRINTLN " @X03Low Message Number@X0F :@X0E ", LOMSGNUM()
PRINTLN " @X03High Message Number@X0F:@X0E ", HIMSGNUM()
PRINTLN "@X0F*@X0D────────────────────────────────────────@X0F*"
'
' Use a different prompt when there are tagged msgs
'
IF (tagged_files) THEN
main_prompt = "@X0AEnter the Message #(s) to Kill, @X02(@X0FTAG@X02)=@X03@X0BTagged @X03Msgs, @X0F(Enter)=none@X07"
ELSE
main_prompt = "@X0AEnter the Message #(s) to Kill @X0F(Enter)=none@X07"
END IF
INPUTSTR main_prompt, user_input, @X0E, 50, " ;0123456789-DELTAG", LFAFTER+UPCASE
IF (user_input = "") GOTO EXIT_PROG
IF (user_input = "TAG") GOSUB PROCESS_TAGGED
user_input = REPLACESTR(user_input, " ", ";")
IF (RIGHT(user_input,1) != ";") user_input = user_input + ";"
ELSE
'
' Process stacked commands
'
WHILE (1) DO
hold = GETTOKEN()
IF (hold = "") BREAK
user_input = user_input + hold + ";"
END WHILE
'
' If ranges of numbers entered, process them in the subroutine to
' convert them to a string of numbers instead of ranges.
' 5-10 converts to 5 6 7 8 9 10
'
IF (INSTR(user_input,"-") > 1) GOSUB CHECK_NUMBER_RANGE
'
END IF
'
' Process user_input until there are no more entries, then exit program
'
WHILE (1) DO
hold = MID(user_input, 1, INSTR(user_input, ";")-1)
user_input = MID(user_input, INSTR(user_input, ";")+1, LEN(user_input)-INSTR(user_input,";"))
IF (hold = "") BREAK
COMMAND FALSE, "K " + hold
END WHILE
GOTO EXIT_PROG
:END_MAIN
'
' Read disk file of tagged msgs into user_input
'
:PROCESS_TAGGED
FOPEN 1, tag_msg_file, O_RD, S_DN
FREAD 1, user_input, FILEINF(tag_msg_file,4)
FCLOSE 1
RETURN
'
'
'
:EXIT_PROG
KBDSTUFF CHR(13)
END
'
' See if user entered a "range" of msg numbers to kill
'
:CHECK_NUMBER_RANGE
'
' Put "user_input" into "stack_var" as we are going to rebuild
' user_input with acutal numbers instead of the range the user
' has entered
'
stack_var = user_input
user_input = ""
'
' Tokenize stack_var so we can process it one entry at a time
'
TOKENIZE stack_var
IF (TOKCOUNT() = 0) RETURN
FOR hold_num = 1 TO LEN(stack_var)
end = 0
start = 0
temp_var = GETTOKEN()
IF (temp_var = "") BREAK
IF (INSTR(temp_var, "-") = 0) THEN
user_input = user_input + temp_var + ";"
ELSE
'
' Input had a "-" in it, so lets process the range request
'
start = S2I(MID(temp_var, 1, INSTR(temp_var,"-")-1),10)
IF (start) end = S2I(MID(temp_var, INSTR(temp_var,"-")+1, LEN(temp_var)),10)
'
' This loop will run from "start" number to "end" number and
' build the "user_input" variable with the acutal numbers. For
' instance an input of "5-10" would equate to "5 6 7 8 9 10 "
' in user_input.
'
IF (end >= start) THEN
FOR count = start TO end
user_input = user_input + STRING(count) + ";"
NEXT
ELSE
'
' If "end" is less than "start" tell the user that it is
' and invalid input and the entry was not processed.
'
NEWLINE
PRINTLN "@X0FEnding value is less than Starting value @X0E(@X0CEntry not processed@X0E)@X07"
END IF
END IF
NEXT
RETURN